<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="stylesheet" href="/static/weui/css/weui.css">
		<link rel="stylesheet" href="/static/weui/css/weuix.css">
		<link rel="stylesheet" href="/static/weui/css/mydmcss.css?r=1">
		<link rel="stylesheet" href="/static/weui/css/animate-mini.css" />
		<script src="/static/weui/js/zepto.min.js"></script>
		<script src="/static/weui/js/zepto.weui.js"></script>
		<script src="/static/weui/js/php.js"></script>
		<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
		<script>
			var tdesc='{$cuser["nickname"]}邀请您，点亮消防安全，共建平安牛城。';
		</script>
		<script src="/static/weui/js/xf.js"></script>
		<script>
			var loading = false;  //状态标记
			let start = 0
			let pagesize=20;
			let flag=true
	
			function ajaxpage(start1){
				$.ajax({
					type:"get",
					data: {"page":start1,"limit":pagesize},
					dataType:'json',
					timeout:10000,
					beforeSend:function(xhr){
						$('.weui-loadmore').show();
					},
					success:function(rs){
						console.log(rs.data);
						if(rs.data==null){
							$(".weui-loadmore").html("已显示全部");
							return false
						}
						rs.pmnumber=(start1-1)*pagesize;
						console.log(rs.pmnumber,start)
						start = start1+1;
						if(count(rs.data)<pagesize){
							flag=false//设置没有数据了标记
							$(document.body).destroyInfinite();
							$(".weui-loadmore").html("已显示全部");
						}
						
						$("#rank-list").append(tpl(document.getElementById('tpl').innerHTML,rs));
					},
					error:function(xhr){
						alert('ajax出错');
					},
				});
			}
			$(function(){
				$(document.body).infinite(100).on("infinite", function() {
					if(loading) return;
					loading = true;
					setTimeout(function() {
						if(flag){
							ajaxpage(start)
						}
						loading = false;
					}, 1500);   //模拟延迟
				});
	
				var l = sessionStorage.getItem('index_list');
				if(null !== l && '' !== l){
					$("#rank-list").html(l);
					$(window).scrollTop(sessionStorage.getItem('index_scroll'));
					start = parseInt(sessionStorage.getItem('index_start'));
					sessionStorage.removeItem('index_list');
					sessionStorage.removeItem('index_page');
					sessionStorage.removeItem('index_scroll');
				}else{
					ajaxpage(1);
				}
			});
			const goto=(id)=>{
				sessionStorage.setItem('index_list',$("#rank-list").html());//存储列表数据
				sessionStorage.setItem('index_start',start);//存储页码
				sessionStorage.setItem('index_scroll',$(window).scrollTop());//存储滚动条位置
				location.href="js91.html?id="+id;
			}
		</script>
		
	<title>区县点亮排行</title>
</head>
<body ontouchstart>
	<div class="weui-header" > 
		<div class="weui-header-left" onclick="javascript:history.back(-1)"> <a  class="icon icon-109 f-white"></a>  </div>
		 <h1 class="weui-header-title"></h1>
	</div>  
	<div class="titleimg">
		<img src="/static/weui/images/dl/rank.jpg">
	</div>

	
	<div class="weui-cells"  id="rank-list">
		<script id="tpl" type="text/html">
			<% for(var i in data) {   %>
				<div class="weui-cell hand" data-id="<%=data[i].id%>">
					<div class="weui-cell__rt" style="margin-right: 5px;">
						<%=parseInt(i)+1+pmnumber%>
					</div>
					
					<div class="weui-cell__bd f14" style="text-align: left; padding-left: 10px;"><%=data[i].qxname%></div>
					<div class="weui-cell__ft"><%=data[i].cynumber%>人</div>
				</div>
					<% } %>
		</script>
	</div>
	
	<div class="weui-loadmore hide f-gray">
		<i class="weui-loading"></i>
		<span class="weui-loadmore__tips">正在加载</span>
	</div>
	
</body>
</html>